package com.ruoyi.scale.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.scale.domain.ScaleTestProject;
import com.ruoyi.scale.mapper.ScaleTestProjectMapper;
import com.ruoyi.scale.service.IScaleTestProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 测评项目Service业务层处理
 *
 * @author dais
 * @date 2023-09-03
 */
@Service
public class ScaleTestProjectServiceImpl implements IScaleTestProjectService {
    @Autowired
    private ScaleTestProjectMapper scaleTestProjectMapper;

    /**
     * 查询测评项目
     *
     * @param testProjectId 测评项目主键
     * @return 测评项目
     */
    @Override
    public ScaleTestProject selectScaleTestProjectByTestProjectId(Long testProjectId) {
        return scaleTestProjectMapper.selectScaleTestProjectByTestProjectId(testProjectId);
    }

    /**
     * 查询测评项目列表
     *
     * @param scaleTestProject 测评项目
     * @return 测评项目
     */
    @Override
    public List<ScaleTestProject> selectScaleTestProjectList(ScaleTestProject scaleTestProject) {
        return scaleTestProjectMapper.selectScaleTestProjectList(scaleTestProject);
    }

    /**
     * 新增测评项目
     *
     * @param scaleTestProject 测评项目
     * @return 结果
     */
    @Override
    public int insertScaleTestProject(ScaleTestProject scaleTestProject) {
        scaleTestProject.setCreateTime(DateUtils.getNowDate());
        return scaleTestProjectMapper.insertScaleTestProject(scaleTestProject);
    }

    /**
     * 修改测评项目
     *
     * @param scaleTestProject 测评项目
     * @return 结果
     */
    @Override
    public int updateScaleTestProject(ScaleTestProject scaleTestProject) {
        scaleTestProject.setUpdateTime(DateUtils.getNowDate());
        return scaleTestProjectMapper.updateScaleTestProject(scaleTestProject);
    }

    /**
     * 批量删除测评项目
     *
     * @param testProjectIds 需要删除的测评项目主键
     * @return 结果
     */
    @Override
    public int deleteScaleTestProjectByTestProjectIds(Long[] testProjectIds) {
        return scaleTestProjectMapper.deleteScaleTestProjectByTestProjectIds(testProjectIds);
    }

    /**
     * 删除测评项目信息
     *
     * @param testProjectId 测评项目主键
     * @return 结果
     */
    @Override
    public int deleteScaleTestProjectByTestProjectId(Long testProjectId) {
        return scaleTestProjectMapper.deleteScaleTestProjectByTestProjectId(testProjectId);
    }
}
